ConvertibleObservableCollection
Collection which maps items to another type to display.
Herda de: BaseObservableCollection
Implementa: IConvertibleObservableCollection<T>, IListEx<T>, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable, ICollectionEx<T>
Construtores
public ConvertibleObservableCollection(ICollection<TDisplay> collection, Func<TItem, TDisplay> converter)
convertibleObservableCollection = ConvertibleObservableCollection(collection, converter)
Collection which maps items to another type to display.
Propriedades
public override int Count { get; }
value = convertibleObservableCollection.Count
Gets the number of elements contained in the ICollection.
Retorna: The number of elements contained in the ICollection.
public TItem Item { get; set; }
value = convertibleObservableCollection.Item
convertibleObservableCollection.Item = value
Gets or sets the element at the specified index.
- index
- The zero-based index of the element to get or set.
Retorna: The element at the specified index.
public TItem[] Items { get; }
value = convertibleObservableCollection.Items
Gets all original items in the collection.
System#Collections#Generic#ICollection{TItem}#IsReadOnly
Gets a value indicating whether the ICollection is read-only.
Retorna: true if the ICollection is read-only; otherwise, false.
Métodos
public void Add(TItem item)
convertibleObservableCollection.Add(item)
Adds an item to the ICollection.
- item
- The object to add to the ICollection.
public void AddRange(IEnumerable<TItem> items)
convertibleObservableCollection.AddRange(items)
Adds a range of items to the collection.
- items
- Items to add.
public void Clear()
convertibleObservableCollection.Clear()
Removes all items from the collection.
public bool Contains(TItem item)
result = convertibleObservableCollection.Contains(item)
Determines whether the ICollection contains a specific value.
- item
- The object to locate in the ICollection.
Retorna: true if is found in the ICollection; otherwise, false.
public void CopyTo(TItem[] array, int arrayIndex)
convertibleObservableCollection.CopyTo(array, arrayIndex)
Copies the elements of the ICollection to an Array, starting at a particular Array index.
- array
- The one-dimensional Array that is the destination of the elements copied from ICollection. The Array must have zero-based indexing.
- arrayIndex
- The zero-based index in at which copying begins.
public IEnumerator<TItem> GetEnumerator()
result = convertibleObservableCollection.GetEnumerator()
Returns an enumerator that iterates through the collection.
Retorna: A IEnumerator that can be used to iterate through the collection.
public int IndexOf(TItem item)
result = convertibleObservableCollection.IndexOf(item)
Determines the index of a specific item in the IList.
- item
- The object to locate in the IList.
Retorna: The index of if found in the list; otherwise, -1.
public void Insert(int index, TItem item)
convertibleObservableCollection.Insert(index, item)
Inserts an item to the IList at the specified index.
- index
- The zero-based index at which should be inserted.
- item
- The object to insert into the IList.
public bool Remove(TItem item)
result = convertibleObservableCollection.Remove(item)
Removes the first occurrence of a specific object from the ICollection.
- item
- The object to remove from the ICollection.
Retorna: true if was successfully removed from the ICollection; otherwise, false. This method also returns false if is not found in the original ICollection.
public void RemoveAll(Func<TItem, bool> pred)
convertibleObservableCollection.RemoveAll(pred)
Remove items for which returns true.
public void RemoveAt(int index)
convertibleObservableCollection.RemoveAt(index)
Removes the IList item at the specified index.
- index
- The zero-based index of the item to remove.
public void RemoveRange(IEnumerable<TItem> items)
convertibleObservableCollection.RemoveRange(items)
Removes a range of items from the collection.
- items
- Items to remove.
public override int RemoveRange(int index, int count)
result = convertibleObservableCollection.RemoveRange(index, count)
Removes a range of items starting at the specified index.
- index
- Starting index.
- count
- Number of items to remove.
Retorna: Number of items removed.
System#Collections#IEnumerable#GetEnumerator()
Returns an enumerator that iterates through a collection.
Retorna: An IEnumerator object that can be used to iterate through the collection.
public TDisplay TryGet(TItem item)
result = convertibleObservableCollection.TryGet(item)
Get display item by item.
Eventos
public event Action<IEnumerable<TItem>> AddedRange
convertibleObservableCollection.AddedRange += handler
Occurs when a range of items is added to the collection.
public event Action<IEnumerable<TItem>> RemovedRange
convertibleObservableCollection.RemovedRange += handler
Occurs when a range of items is removed from the collection.